//引入mongoose
const mongoose = require('mongoose')
//定义Schema
const RolesSchema = mongoose.Schema({
  name: {
    type: String,
    required: true
  },
  auth_name: { //授权人
    type: String
  },
  auth_time: {// 授权时间
    type: Number
  },
  menus: { // 所有有权限操作的菜单path的数组
    type: Array
  },
  rights: { // 所有有权限操作的按钮(add,edit,delete,update)的数组
    type: Array
  },
  create_time: {
    type: Date,
    default: Date.now
  }
})
//暴露
module.exports = mongoose.model('Role', RolesSchema)